#ifndef __IO_H__
#define __IO_H__

#include "linux/page.h"
#include "linux/types.h"
#include "linux/compiler.h"
#include "linux/byteorder/little_endian.h"

#ifndef __raw_readl
#define __raw_readl __raw_readl
static inline u32 __raw_readl( volatile void __iomem *addr)
{
	return *( volatile u32 __force *)addr;
}
#endif

#ifndef __raw_writeb
#define __raw_writeb __raw_writeb
static inline void __raw_writeb(u8 value, volatile void __iomem *addr)
{
	*(volatile u8 __force *)addr = value;
}
#endif

#ifndef __raw_writew
#define __raw_writew __raw_writew
static inline void __raw_writew(u16 value, volatile void __iomem *addr)
{
	*(volatile u16 __force *)addr = value;
}
#endif

#ifndef __raw_writel
#define __raw_writel __raw_writel
static inline void __raw_writel(u32 value, volatile void __iomem *addr)
{
	*(volatile u32 __force *)addr = value;
}
#endif


static inline u32 readl( volatile void __iomem *addr)
{
    return __raw_readl(addr);
}

#ifndef writeb
#define writeb writeb
static inline void writeb(u8 value, volatile void __iomem *addr)
{
	__raw_writeb(value, addr);
}
#endif

#ifndef writew
#define writew writew
static inline void writew(u16 value, volatile void __iomem *addr)
{
    __raw_writew(value, addr);
}
#endif

#ifndef writel
#define writel writel
static inline void writel(u32 value, volatile void __iomem *addr)
{
    __raw_writel(value, addr);
}
#endif

#ifndef readl_relaxed
#define readl_relaxed readl
#endif


#ifndef writeb_relaxed
#define writeb_relaxed writeb
#endif

#ifndef writew_relaxed
#define writew_relaxed writew
#endif

#ifndef writel_relaxed
#define writel_relaxed writel
#endif

#define readb(addr) ((*(volatile unsigned char *)(addr)))

#if 0
static inline void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
{
	return (void __iomem *)phys_addr;
}
#else
void __iomem *ioremap(unsigned long addr, unsigned long size);
void __iomem *early_ioremap(unsigned long addr, unsigned long size);
#endif

int ioremap_page_range(unsigned long addr, unsigned long end, phys_addr_t phys_addr, pgprot_t prot);

#endif
